<template>
  <div class="relative w-full h-full">
    <PageHeader title="意见反馈" />
    <el-radio-group v-model="type" class="mb12">
      <el-radio-button label="新增意见反馈列表" value="1" />
      <el-radio-button label="已处理意见反馈" value="2" />
    </el-radio-group>
    <SearchCom :searchList="searchConfig" @search="handleSearch" />
    <el-table
      :data="tableData"
      style="width: 100%"
      class="cover-table mt12"
      height="calc(100% - 200px)"
      border
    >
      <el-table-column label="序号" width="80">
        <template #default="scope">
          <span>{{ scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="content" label="反馈信息" />
      <el-table-column prop="user_name" label="反馈人" />
      <el-table-column prop="user_phone" label="反馈人手机号" />
      <el-table-column prop="create_time" label="反馈时间" />
      <el-table-column label="操作">
        <template #default="scope">
          <el-button type="text" @click="handleEdit(scope.row)"
            >查看</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <div class="flex justify-end mt24 absolute bottom-0 right-0">
      <el-pagination
        v-model:current-page="currentPage"
        v-model:page-size="pageSize"
        :page-sizes="[10, 20, 30, 40]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="400"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
    <EditDia v-model="editDiaVisible" :data="editDiaData" :type="type"></EditDia>
  </div>
</template>

<script setup>
import { ref } from "vue";
import EditDia from "./editDia.vue";
import SearchCom from "@/components/SearchCom.vue";
const searchConfig = ref([
  {
    label: "反馈时间",
    key: "date",
    type: "daterange",
  },
]);

const type = ref("1");
const statusList = ref([
  { label: "即将到期", value: 1 },
  { label: "到期未缴纳", value: 2 },
  { label: "已缴纳", value: 3 },
]);
const editDiaVisible = ref(false);
const editDiaData = ref({});
const currentPage = ref(1);
const pageSize = ref(10);
const tableData = ref(
  Array(10).fill({
    content: "反馈信息",
    user_name: "反馈人",
    user_phone: "反馈人手机号",
    create_time: "2024-01-01 12:00:00",
  })
);
const handleSearch = (data) => {
  console.log(data);
};
const handleEdit = (row) => {
  editDiaVisible.value = true;
  editDiaData.value = JSON.parse(JSON.stringify(row));
};
const handleSizeChange = (size) => {
  pageSize.value = size;
};
const handleCurrentChange = (page) => {
  currentPage.value = page;
};
</script>

<style lang="scss" scoped>
.addBtn {
  height: 28px;
  margin-left: 10px;
  padding: 0 7px;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}
.split {
  width: 1px;
  height: 12px;
  background: #ddd;
  margin: 0 5px;
}
</style>
